<template>
  <div class="accessory-section">
    <h2>配件专区</h2>
    <div class="products-grid">
      <div
        class="product-card"
        v-for="product in accessoryProducts"
        :key="product.id"
      >
        <div class="product-image">
          <!-- 产品图片占位 -->
          <div class="placeholder-img">配件图片</div>
        </div>
        <h3 class="product-name">{{ product.name }}</h3>
        <p class="product-price">¥{{ product.price }}</p>
        <p class="product-desc">{{ product.description }}</p>
        <button class="add-to-cart">加入购物车</button>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from "vue";

// 配件产品数据
const accessoryProducts = ref([
  {
    id: 5,
    name: "无线蓝牙耳机",
    price: 599,
    description: "主动降噪，音质出色",
  },
  {
    id: 6,
    name: "快充充电器",
    price: 199,
    description: "65W 快充，多协议支持",
  },
]);
</script>

<style scoped>
.accessory-section h2 {
  color: #2ecc71;
  border-bottom: 2px solid #2ecc71;
  padding-bottom: 10px;
  margin-top: 0;
}

/* 产品网格和卡片样式与其他专区共享 */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.product-card {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px;
  transition: all 0.3s ease;
}

.product-card:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transform: translateY(-5px);
}

.placeholder-img {
  height: 150px;
  background-color: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  margin-bottom: 15px;
}

.product-price {
  color: #2ecc71;
  font-weight: bold;
  font-size: 1.1rem;
}

.product-desc {
  color: #666;
  font-size: 0.9rem;
  margin: 10px 0;
}

.add-to-cart {
  background-color: #2ecc71;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.add-to-cart:hover {
  background-color: #27ae60;
}
</style>
